package org.nlp2rdf.navigator.server.tiger;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dllearner.core.EvaluatedDescription;
import org.dllearner.core.Score;
import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.DescriptionVisitor;
import org.dllearner.core.owl.KBElementVisitor;

public class Worker2Stub implements IWorker2 {
	
	Log log = LogFactory.getLog(Worker2Stub.class);

	public File collect(List<URL> urls) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Sentence> getSentences(EvaluatedDescription ed, int resultLimit) {
		List<Sentence> sentences = new ArrayList<Sentence>();
		
		sentences.add(new Sentence("senteces for description1", "uriririri"));
		sentences.add(new Sentence("senteces for description2", "uriririri2"));
		return sentences;
	}
	
	public RetrievalResult getSentencesNew(EvaluatedDescription ed, int resultLimit) {
		List<Sentence> sentences = new ArrayList<Sentence>();
		
		sentences.add(new Sentence("senteces for description1", "uriririri"));
		sentences.add(new Sentence("senteces for description2", "uriririri2"));
		RetrievalResult retrievalResult = new RetrievalResult();
		retrievalResult.setNrOfResults(sentences.size());
		retrievalResult.setSentences(sentences);
		
		return retrievalResult;
	}
	
	public String getLabelForURI(String uri){
		return "some label: "+System.currentTimeMillis();
	}

	public EvaluatedDescription learn(List<Sentence> pos, List<Sentence> neg,
			int maxSeconds) {
		Description desc = new Description() {
			
			public String toString(String arg0, Map<String, String> arg1) {
				
				return "eval DescRandId=" +new Random().nextInt();
			}
			
			public String toKBSyntaxString(String arg0, Map<String, String> arg1) {
				// TODO Auto-generated method stub
				return null;
			}
			
			public int getLength() {
				// TODO Auto-generated method stub
				return 0;
			}
			
			public void accept(KBElementVisitor arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public String toManchesterSyntaxString(String arg0, Map<String, String> arg1) {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public int getArity() {
				// TODO Auto-generated method stub
				return 0;
			}
			
			@Override
			public void accept(DescriptionVisitor arg0) {
				// TODO Auto-generated method stub
				
			}
		};
		
		Score score = new Score() {
			
			@Override
			public double getAccuracy() {
				
				return 66.66;
			}
		};
		EvaluatedDescription edesc = new EvaluatedDescription(desc, score);
		return edesc;
	}

	public SearchResult searchFulltext(String search, int nrOfResults) {
		log.info("fulltextsearch");
		
		
		
		return createSearchResult();
	}

	public SearchResult searchLemmas(String search, int nrOfResults) {
		
		return createSearchResult();
	}
	
	
	private SearchResult createSearchResult(){
		List<Sentence> sentencesMatch = new ArrayList<Sentence>();
		
		sentencesMatch.add(new Sentence("senteces for match1", "urimatch1"));
		sentencesMatch.add(new Sentence("senteces for match2", "urimatch2"));
		
		List<Sentence> sentencesNonMatch = new ArrayList<Sentence>();
		
		sentencesNonMatch.add(new Sentence("senteces for Nonmatch1", "uriNonmatch1"));
		sentencesNonMatch.add(new Sentence("senteces for Nonmatch2", "uriNonmatch2"));
		
		return new SearchResult(sentencesMatch, sentencesNonMatch);
	}

	public String getLabelsForConcept(String name) {
		// TODO Auto-generated method stub
		return null;
	}

}
